part of '../controller.dart';

class _NotificationDtoFactory {
  const _NotificationDtoFactory._internal();

  static const _instance = _NotificationDtoFactory._internal();

  factory _NotificationDtoFactory() {
    return _instance;
  }

  _NotificationDto fromJson(Map<String, dynamic> json) {
    final type = json[_kNotificationTypeKey] as String;

    if (type == _kYookassaApiSucceededPaymentNotificationTypeValue ||
        type == _kYookassaApiCanceledPaymentNotificationTypeValue ||
        type == _kYookassaApiSucceededRefundNotificationTypeValue) {
      return _YookassaApiPaymentNotificationDto.fromJson(json);
    }

    throw UnimplementedError();
  }
}
